package com.mzy.datepackage.M2022.July.eleventh;

import org.testng.annotations.Test;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author mzy
 * @Date 2022/7/11 10:14
 * @Version 1.0
 */
public class PollingThread {

    /**
     * 轮询线程模拟
     */
    private static final ScheduledExecutorService executorService =Executors.newScheduledThreadPool(2);

    public static void main(String[] args) {

        TimerTask2 timerTask2 = new TimerTask2();
        executorService.scheduleAtFixedRate(timerTask2,0,5000, TimeUnit.MILLISECONDS);
    }


    @Test
    public void pollingThread(){

    }


}

class TimerTask2 implements Runnable {



    @Override
    public void run() {
        System.out.println("ScheduledExecutorService:测试开始");
    }
}
